<?php

class Web_Admin_Marcas_Svc_ActualizarMarca
{

    public function doIt()
    {
        $this->actualizar();
    }

    public function actualizar()
    {
        $id = Ey::getPrm(4);
        
        $obj = new Web_Db_Marcas();
        
        $row = array('ma_titulo' => $_POST['titulo'],
                     'ma_url' => $_POST['url']);
        
        $obj->update($row, 'ma_id=' . $id);

        $handle = new Ey_Upload($_FILES['imagen']);

        if ($handle->uploaded) {
            $handle->file_new_name_body = 'marca_' . $id;
            $handle->file_new_name_ext = 'jpg';
            $handle->image_resize = true;
            $handle->image_ratio_crop = true;
            $handle->image_x = 190;
            $handle->image_y = 90;
////            $handle->image_watermark = APP_ROOT . DS . '_data/img/marcaaguagrapkids.png';
            $handle->process(APP_ROOT . DS . '_data/img/marcas');
            $handle->clean();
        }

        Ey::redirect(WEB_ROOT . '/admin/marcas');
    }

}